#include <QtGui>
#include <QTranslator>
#include <QtCore/QTextCodec>
#include "gv_zoneshomedialog.h"
#include "gv_zonesconfigurationdetaildialog.h"
#include "gv_zonesconfiguration.h"
#include "gv_zonesstatusdialog.h"
#include "gv_home.h"
#include "gv_setting.h"

extern GV_Setting *gvsetting;
extern QDialog  *dialog;
GV_ZonesStatusDialog::GV_ZonesStatusDialog(QWidget *parent)
       : QDialog(parent)
{
    setupUi(this);

    QTranslator translator;
    translator.load(gvsetting->GV_GetLanguage(),".");
    qApp->installTranslator(&translator);
    reloadtext();

    TimeHintsLabel->setText((QDateTime::currentDateTime().toString("hh:mm:ss")));
    DateHintsLabel->setText((QDateTime::currentDateTime().toString("yyyy-MM-dd")));
    timer = new QTimer;
    connect(timer,SIGNAL(timeout()),this,SLOT(GV_chTime()));
    connect(BackButton,SIGNAL(clicked()),this,SLOT(home()));
    connect(CancelButton,SIGNAL(clicked()),this,SLOT(home()));

    connect(ZoneNameChangeButton,SIGNAL(clicked()),this,SLOT(zonenamechange()));
    connect(ConfigurationButton,SIGNAL(clicked()),this,SLOT(configuration()));

    timer->start(1000);
}
void GV_ZonesStatusDialog::reloadtext()
{

    NameHintsLabel->setText(tr("Zones"));

    ZoneNameChangeButton->setText(tr("Zone 1"));
    BackButton->setText(tr("Back"));
    CancelButton->setText(tr("Cancel"));
    ConfigurationButton->setText(tr("Configuration"));

    LabelLeftPortsColumn->setText(tr("Ports"));
    LabelLeftStatusColumn->setText(tr("Status"));

    LabelRightPortsColumn->setText(tr("Ports"));
    LabelRightStatusColumn->setText(tr("Status"));

    LabelPortStatus01->setText(tr("standby"));
    LabelPortStatus02->setText(tr("standby"));
    LabelPortStatus03->setText(tr("standby"));
    LabelPortStatus04->setText(tr("standby"));
    LabelPortStatus05->setText(tr("standby"));
    LabelPortStatus06->setText(tr("standby"));
    LabelPortStatus07->setText(tr("standby"));
    LabelPortStatus08->setText(tr("standby"));
}
void GV_ZonesStatusDialog::GV_chTime()
{
    TimeHintsLabel->setText((QDateTime::currentDateTime().toString("hh:mm:ss")));
    DateHintsLabel->setText((QDateTime::currentDateTime().toString("yyyy-MM-dd")));
}

void GV_ZonesStatusDialog::home()
{
    QDialog *dialog1 = new GV_ZonesHomeDialog;
    dialog1->show();
    delete dialog;
    dialog = dialog1;
}

void GV_ZonesStatusDialog::configuration()
{
    QDialog *dialog1 = new GV_ZonesConfigurationDetailDialog;
    dialog1->show();
    delete dialog;
    dialog = dialog1;
    //TODO

}
void GV_ZonesStatusDialog::zonenamechange()
{
    QDialog *dialog1 = new GV_ZonesConfigurationDialog;
    dialog1->show();
    delete dialog;
    dialog = dialog1;
    //TODO

}

